<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8" />
		<title>1.sessionStorage</title>
	</head>
	<body>
		<button onclick="savePerson()">点我将人存入sessionStorage</button>
		<button onclick="readPerson()">点我从sessionStorage读取人</button>
		<button onclick="deletePerson()">点我从sessionStorage删除人</button>
		<button onclick="clearPerson()">点我清空sessionStorage中的数据</button>

		<script type="text/javascript" >
			let person = {name:'强',age:18}

			function savePerson(){
				sessionStorage.setItem('ren',JSON.stringify(person))
			}

			function readPerson(){
				const result = sessionStorage.getItem('ren')
				console.log(JSON.parse(result))
			}

			function deletePerson(){
				sessionStorage.removeItem('ren')
			}

			function clearPerson(){
				sessionStorage.clear()
			}
		</script>

	</body>
</html>